[//
    async function( kuo,Context,context){
        Context.headers["content-type"] = 'application/json;charset=UTF-8';
        let $THIS =  this;
        let $features = await Kuoplus(kuo.class);
        let $LANG = this.LANG();
        let $DATA = Object.assign({},this.$DATA);
        let $_POST = kuo.post;
        let $_GET = kuo.get;
        let $phone  =  $_POST['phone']?$_POST['phone']: "";
        let $password =  $_POST['password'] ?$_POST['password']:"";
        let $code     =  ""+($_POST['code'] ?$_POST['code']:"");
        let $tuid = $_GET['tuid'] ?$_GET['tuid']:0;//推广uid
        let $fcode =  $_POST['fcode'] ?$_POST['fcode']: "";
        let $USER = null;
        let $Security = await Mem.Get("session/"+kuo.sessionid);
        let $codeoff  = 0; //验证码开关
        let $chauid = 0; //用户id
        let $KJBIAO = "REG"; //标记是否是快捷注册
        if($Security && $Security["uid"]){
            $chauid = $Security["uid"];
        }
        if(!$Security ){
            $Security={
                uid:0,
                code:0,
                tuid:0
            };
        }

        if(!$THIS.Isphone($phone) ){
            $DATA.code = -1;
            $DATA.msg = $LANG.phone_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }

        if(strlen($password ) < 6 || strlen($password ) > 64){
            $DATA.code = -1;
            $DATA.msg = $LANG.password_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }

        if($features['configure']['phone验证码'] && $features['configure']['phone验证码']['0']){
            $codeoff = $features['configure']['phone验证码']['0'];
        }

        if($codeoff > 0){
            if( $code =='' || !$Security || $code != $Security['code']){
                $DATA.code = -1;
                $DATA.msg = $LANG.vcode_error;
                Context.body = JSON.stringify($DATA);
                return ;
            }
        }
        let ipci = await Mem.Get("security/"+kuo.ip);
        if( ipci > $THIS.$Securitynum){
            $DATA.code = -1;
            $DATA.msg = $LANG.phone_no;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        let $GetCode = await $THIS.GetCode($phone);
        if(!$GetCode){
            $DATA.code = -1;
            $DATA.msg = $LANG.fasong_code;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        if($GetCode != $fcode){
            await Mem.Add("security/"+kuo.ip,1, $THIS.$Securitytime);
            $DATA.code = -1;
            $DATA.msg = $LANG.code_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        let $db = await db("login_phone");
        let $user = await $db.Where( {'phone':$phone } ).Find();
        if($user){
            await Mem.Add("security/"+kuo.ip,1, $THIS.$Securitytime);
            $DATA.code = -1;
            $DATA.msg = $LANG.phone_true;
            Context.body = JSON.stringify($DATA);
            return ;
        }

        if($chauid > 0){
            let $chaxun = await $db.Where( {'uid':$chauid } ).Find();
            if($chaxun){
                $DATA.code = -1;
                $DATA.msg = $LANG.phone_false;
                Context.body = JSON.stringify($DATA);
                return ;
            }

        }else{
            $chauid = await $THIS.REG({
                "name":$phone,
                "sex":-1,
                "tou": "",
                "ip":kuo.ip,
                'tuid':$tuid
            });
        }
        if(!$chauid || $chauid < 1){
            $DATA.code = -1;
            $DATA.msg = $LANG.uuid_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        Mem.Del("security/"+kuo.ip);
        $user = {
            'phone':$phone,
            'password': Kuomm($password),
            'uid': $chauid
        };
        let $fan = $db.Insert($user);
        if($fan){
            $THIS.DelCode($phone);
            $Security['uid'] = $user['uid'];
            await Mem.Put("session/"+kuo.sessionid,$Security,Expiredseconds);
            await  Kuolog('userlog',$user['uid'],0, $KJBIAO ,kuo.func_,kuo.class,kuo.ip);
            $USER = await Uid( $user['uid'] );
            $USER['avatar'] = pichttp($USER['avatar']==""?"Tpl/login/avatar/"+($USER['id']%10)+".png":$USER['avatar']);
            $DATA.code = 1;
            $DATA.msg = $LANG.reg_true;
            $DATA.data = $USER;
            $DATA.apptoken = kuo.sessionid;
            Context.body = JSON.stringify($DATA);
        }else{
            $DATA.code = -1;
            $DATA.msg = $LANG.reg_false;
            Context.body = JSON.stringify($DATA);
        }
    } 
]